package com.cloud.system.api.entity;

import javax.persistence.*;

@Table(name = "role_resources")
public class RoleResources {
	@Id
	@Column(name = "role_id")
	private Long roleId;

	@Id
	@Column(name = "res_id")
	private Long resId;

	@Id
	@Column(name = "res_type")
	private Integer resType;

	@Column(name = "partial_select")
	private Integer partialSelect; //选中下级节点级联选中

	public Long getRoleId() {
		return roleId;
	}

	public void setRoleId(Long roleId) {
		this.roleId = roleId;
	}

	public Long getResId() {
		return resId;
	}

	public void setResId(Long resId) {
		this.resId = resId;
	}

	public Integer getResType() {
		return resType;
	}

	public void setResType(Integer resType) {
		this.resType = resType;
	}

	public Integer getPartialSelect() {
		return partialSelect;
	}

	public void setPartialSelect(Integer partialSelect) {
		this.partialSelect = partialSelect;
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((resId == null) ? 0 : resId.hashCode());
		result = prime * result + ((resType == null) ? 0 : resType.hashCode());
		result = prime * result + ((roleId == null) ? 0 : roleId.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		RoleResources other = (RoleResources) obj;
		if (resId == null) {
			if (other.resId != null)
				return false;
		} else if (!resId.equals(other.resId))
			return false;
		if (resType == null) {
			if (other.resType != null)
				return false;
		} else if (!resType.equals(other.resType))
			return false;
		if (roleId == null) {
			if (other.roleId != null)
				return false;
		} else if (!roleId.equals(other.roleId))
			return false;
		return true;
	}
}